package com.platform.controller.platform;

import com.platform.common.annotation.Log;
import com.platform.common.core.domain.AjaxResult;
import com.platform.common.core.page.TableDataInfo;
import com.platform.common.enums.BusinessType;
import com.platform.common.enums.ResultEnum;
import com.platform.common.exception.BusinessException;
import com.platform.system.domain.dto.device.AiUiConfigDto;
import com.platform.system.domain.vo.device.AiUiConfigVo;
import com.platform.system.domain.vo.device.DeviceLogVo;
import com.platform.system.service.ISysAiUiConfigService;
import com.platform.system.service.ISysDeviceLogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author Huangkai
 */
@Slf4j
@RestController
@RequestMapping("/device/log")
public class DeviceLogController {

    @Resource
    ISysDeviceLogService sysDeviceLogService;

    /**
     * 查询日志
     */
    @Log(title = "查询设备日志", businessType = BusinessType.OTHER)
    @GetMapping("/selectDeviceLogList")
    public TableDataInfo selectDeviceLogList(@Validated DeviceLogVo deviceLogVo) {
        return sysDeviceLogService.selectDeviceLogList(deviceLogVo);
    }
    /**
     * 新增
     */
    @Log(title = "新增设备日志", businessType = BusinessType.INSERT)
    @PostMapping("/insertDeviceLog")
    public AjaxResult insertDeviceLog(@RequestBody @Validated DeviceLogVo deviceLogVo) {
        return sysDeviceLogService.insertDeviceLog(deviceLogVo);
    }


    /**
     * 清空
     */
    @Log(title = "清空设备日志", businessType = BusinessType.DELETE)
    @PostMapping("/emptyDeviceLog")
    public AjaxResult emptyDeviceLogList() {

        return sysDeviceLogService.emptyDeviceLogList();
    }

}
